<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增商品')" />
</head>
<!--<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-product-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">货品名称：</label>
                <div class="col-sm-8">
                    <input name="proName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">成本价格：</label>
                <div class="col-sm-8">
                    <input name="proCostprice" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">销售价格：</label>
                <div class="col-sm-8">
                    <input name="proSaleprice" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货品品牌：</label>
                <div class="col-sm-8">
                    <input name="brand" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货品照片：</label>
                <div class="col-sm-8">
                    <input name="photo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">货品信息：</label>
                <div class="col-sm-8">
                    <input name="info" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/product"
        $("#form-product-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-product-add').serialize());
            }
        }
    </script>
</body>-->
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-product-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">货品名称：</label>
            <div class="col-sm-8">
                <input name="proName" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">成本价格：</label>
            <div class="col-sm-8">
                <input name="proCostprice" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">销售价格：</label>
            <div class="col-sm-8">
                <input name="proSaleprice" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">货品品牌：</label>
            <div class="col-sm-8">
                <input name="brand" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">上传图片：</label>
            <div class="col-sm-8">
                <input type="hidden" name="photo">
            <div class="file-loading">
                <input class="form-control file-upload" id="photo" name="file" type="file">
            </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">货品信息：</label>
            <div class="col-sm-8">
                <input name="info" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript">
    var prefix = ctx + "system/product"
    $("#form-product-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-product-add').serialize());
        }
    }

    $(".file-upload").fileinput({
        uploadUrl: ctx + 'common/upload',
        maxFileCount: 1,
        autoReplace: true
    }).on('fileuploaded', function (event, data, previewId, index) {
        $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
    }).on('fileremoved', function (event, id, index) {
        $("input[name='" + event.currentTarget.id + "']").val('')
    })
</script>
</body>
</html>